package com.gufe.mapper.admin.club;

import com.gufe.entity.PPTQueryParam;
import com.gufe.entity.PrecollectMember;
import com.gufe.vo.PPTvo.CollegeCountVO;
import com.gufe.vo.PPTvo.GradeCountVO;
import com.gufe.vo.PPTvo.MemberVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface RetireMemberMapper {

    /**
     * 条件查询预征班人员数据
     * @return
     */
    ArrayList<MemberVO> getMembers(@Param("pptQueryParam") PPTQueryParam pptQueryParam, @Param("statusList") List<Integer> statusList);

    /**
     * 根据ID获取预征班成员信息
     * @param id
     * @return
     */
    @Select("select * from precollect_members where id = #{id}")
    PrecollectMember getMemberById(Integer id);

    /*根据学号得到预征班成员信息*/
    @Select("SELECT * from precollect_members where student_id = #{studentId}")
    PrecollectMember getPrecollectMemberBystudentId(String studentId);

    @Select("SELECT IFNULL(college, '未分配学院') AS college, COUNT(*) AS member_count FROM precollect_members " +
            "WHERE status != 0 GROUP BY college ORDER BY member_count DESC")
    List<CollegeCountVO> getCollegeCount();

    List<GradeCountVO> getGradeCount();

    /*根据学号删除预征班成员*/
    @Delete("DELETE from precollect_members where student_id = #{studentId}")
    void deleteByStudentId(String studentId);

    String getPhysicalTestByStudentId(Long studentId);

}
